package com.school.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.zth.interceptor.LoginInterceptor;

@Configuration
public class LoginConfig implements WebMvcConfigurer{
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		
		InterceptorRegistration registration=registry.addInterceptor(new LoginInterceptor());
		
		registration.addPathPatterns("/pages/**");//拦截所有页面
		
		registration.excludePathPatterns(//不拦截的页面
				"/account/findByUsernameAndPassword"
				,"/pages/account/**"
				);
	}
}
